<?php
namespace App\Services;

class Password
{
    private $charset = 'abcdefghkmnprstuvwxyzABCDEFGHKMNPRSTUVWXYZ123456789';//随机因子
    private $password;//验证码
    private $length = 8;//验证码长度

    //生成随机码

    public function createRandomPassword() {
        $_len = strlen($this->charset)-1;
        for ($i=0;$i<$this->length;$i++) {
            $this->password .= $this->charset[mt_rand(0,$_len)];
        }
        return $this->password;
    }

}